import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';
import { nagGroupDefaultProps } from './defaultProps';
import type { NagGroupOptions } from './type';

export interface NagGroupProps extends NagGroupOptions, HTMLAttributes<HTMLDivElement> {}

const NagGroup: FC<NagGroupProps> = (props) => {
  const { className, ui, children, forwardedRef, ...nagGroupProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames({ ui }, 'nags', className), ...nagGroupProps },
    children,
  );
};

NagGroup.displayName = 'NagGroup';
NagGroup.defaultProps = nagGroupDefaultProps;

export default NagGroup;
